package com.glsc.ngateway.common.base.converter.platform;

import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.OwnCloudOperateLog;
import com.glsc.ngateway.common.base.domainmapper.OwnCloudOperateLogMapper;
import com.glsc.ngateway.common.api.platform.dto.owncloud.OwnCloudOperateLogDto;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author xuchang
 */
public class OwnCloudOperateLogConverter {
    public static OwnCloudOperateLogDto do2Dto(OwnCloudOperateLog hostDo){
        return OwnCloudOperateLogMapper.INSTANCE.domain2dto(hostDo);
    }

    public static List<OwnCloudOperateLogDto> do2Dto(List<OwnCloudOperateLog> hostDoList){
        return CollectionUtils.isEmpty(hostDoList) ? java.util.Collections.emptyList() : hostDoList.stream().map(OwnCloudOperateLogConverter::do2Dto).collect(Collectors.toList());
    }

    public static OwnCloudOperateLog dto2Do(OwnCloudOperateLogDto hostDto){
        return OwnCloudOperateLogMapper.INSTANCE.dto2domain(hostDto);
    }

    public static List<OwnCloudOperateLog> dto2Do(List<OwnCloudOperateLogDto> hostDtoList){
        return CollectionUtils.isEmpty(hostDtoList) ? java.util.Collections.emptyList() : hostDtoList.stream().map(OwnCloudOperateLogConverter::dto2Do).collect(Collectors.toList());
    }
}
